var url="http://192.168.0.101";

function checklogin() {
	$.ajax({
		url : "/system/checkLogin",
		type : "post",
		dataType : "json",
		async : false,
		success : function(data) {
			if (data.code == 0) {
				
			} else {
				location.href="login.html";
			}
		},
		error : function(jqXHR, textStatus, errorThrown) {
		}
	});
}

function checkWXLogin() {
	//获取用户登录状态，如果未登录，则跳转到登录页面
	var userInfoStr = localStorage.getItem("user_info");
	if(userInfoStr == "" || userInfoStr == null) {
		alert("请登录后再试");
		window.location.href="login.html";
	}
}

function formatDate(now_l) {
	var now = new Date(now_l);
	var year=now.getYear().toString();     
	var month=now.getMonth()+1;     
	var date=now.getDate();     
	var hour=now.getHours();     
	var minute=now.getMinutes();     
	var second=now.getSeconds();     
	if(month<10)
	{
		month='0'+month;
	}
	if(date<10)
	{
	 date='0'+date;
	}
	return "20"+year.substr(1,year.length)+"-"+month+"-"+date+" "+hour+":"+minute+":"+second;
}

function formatDateYMD(now_l, cut) {
	var now = new Date(now_l);
	var year=now.getYear().toString();
	var month=now.getMonth()+1;     
	var date=now.getDate();     
	if(month<10)
	{
		month='0'+month;
	}
	if(date<10)
	{
	 date='0'+date;
	}
	return "20"+year.substr(1,year.length) + cut + month + cut + date;
}